import request from '../utils/request'
export function getPostList(param) {
  const tagsId = Array.isArray(param.tagsId) ? param.tagsId.join(',') : param.tagsId;
  return request({
    url: '/post/list',
    method: 'get',
    params: {  // GET请求使用params
      pageNum: param.pageNum,
      pageSize: param.pageSize,
      keyword: param.keyword,
      tagsId: tagsId,
    },
  })
}
export function getlatestAndHottest() {
  return request({
    url: '/post/latestAndHottest',
    method: 'get',
  })
}
export function getPostById(id) {
  return request({
    url: '/post/getById',
    method: 'get',
    params: { id: id }
  })
}
export function getPostDetailById(postId) {
  return request({
    url: '/post/detail/' + postId,
    method: 'get',
  })
}

export function saveOrUpdate(post) {
  return request({
    url: '/post/save',
    method: 'post',
    data: post
  })
}



